package com.mck.service.impl;

import com.mck.entity.FeedBack;
import com.mck.service.FeedBackService;
import org.springframework.stereotype.Service;
import com.mck.mapper.FeedBackMapper;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @version 1.0.0
 * @Author mck
 * @Date 2025/5/4 下午5:06
 * @注释
 */

@Service
public class FeedBackServiceImpl implements FeedBackService {

    private final FeedBackMapper feedBackMapper;

    public FeedBackServiceImpl(FeedBackMapper feedBackMapper) {
        this.feedBackMapper = feedBackMapper;
    }

    // 添加反馈
    @Override
    public void addFeedBack(FeedBack feedBack) {
        feedBack.setCreateTime(LocalDateTime.now());

        feedBackMapper.addFeedBack(feedBack);
    }

    // 获取反馈列表
    @Override
    public List<FeedBack> getFeedBackList() {
        return feedBackMapper.getFeedBackList();
    }

    // 获取指定反馈列表
    @Override
    public List<FeedBack> getFeedBackListBySpecific(FeedBack feedBack) {
        return feedBackMapper.getFeedBackListBySpecific(feedBack);
    }

    // 删除反馈
    @Override
    public void deleteFeedBack(List<Integer> feedBackId) {
        for (Integer id : feedBackId) {
            feedBackMapper.deleteFeedBack(id);
        }
    }

    // 更新反馈
    @Override
    public void updateFeedBack(FeedBack feedBack) {
        feedBack.setUpdateTime(LocalDateTime.now());
        feedBackMapper.updateFeedBack(feedBack);
    }
}
